package cn.itsource.basic.util;

import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.concurrent.TimeUnit;

@Component //交给spring管理
public class EmailService {
    @Autowired
    private JavaMailSender javaMailSender;

    public void sendEMail(String title,String content,String... to) {
        //核心对象
        SimpleMailMessage mailMessage = new SimpleMailMessage();

        //封装参数
        mailMessage.setFrom("370128609@qq.com");
        mailMessage.setText(content);
        mailMessage.setSubject(title);
        mailMessage.setTo(to);
        //发送邮件
        javaMailSender.send(mailMessage);
    }
}
  